﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using microCRM.Domain;

namespace microCRM
{
    public partial class NewContract : Form
    {
        Contract newContract;
        public NewContract()
        {
            InitializeComponent();
            newContract = new Contract();
        }

        private void btn_createAbon_Click(object sender, EventArgs e)
        {
            NewClient newClient = new NewClient();
            newClient.MdiParent = this.MdiParent;
            newClient.Show();
            newClient.OnLoad += new NewClient.ClientLoad(setClient);
        }

        private void btn_SearchClient_Click(object sender, EventArgs e)
        {
            FindClient findClient = new FindClient();
            findClient.MdiParent = this.MdiParent;
            findClient.Show();
            findClient.OnLoad += new FindClient.ClientLoad(setClient);
        }

        public void setClient(Client client)
        {
            this.newContract.Client = client;
            this.lbl_ClientInfo.Text = newContract.Client.FirstName + " " + newContract.Client.MiddleName + " "
                                  + newContract.Client.LastName + "\n" + newContract.Client.DateOfBirth + "\n"
                                  + newContract.Client.Adress+"\n"+newContract.Client.DocumentSerialNumber
                                  + " " + newContract.Client.PersonalNumber;
            this.lbl_ClientInfo.Visible = true;
        }
    }
}
